Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom serializer support #80

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Gerych1984
Copy link

Q A
Is bugfix?
New feature? ✔️
Breaks BC?

Allow custom, user defined serializers. Igbinary for example

Copy link

what-the-diff bot commented Mar 14, 2024

PR Summary

  • Introduction of PhpSerializer Class
    A new PhpSerializer class has been added. This class correctly implements the freshly introduced SerializerInterface interface, streamlining its coding standards.

  • Enhancements to DbCache.php class
    The class DbCache.php has undergone several changes aimed at improving its overall functionality:

    • A new property called $serializer has been added which will adhere to the SerializerInterface type.
    • The constructor has been modified and can now accept an optional $serializer parameter, making the class more adaptable. If no parameter is provided, PhpSerializer will be used as the default one.
    • The class no longer calls unserialize and serialize. Instead, it opts for $this->serializer->restore and $this->serializer->serialize, ensuring that the class operates as per the specifications of the SerializerInterface.
  • Inception of SerializerInterface
    A new interface titled SerializerInterface has been established.

  • Tests for PhpSerializer
    A fresh test suite named PhpSerializerTest has been introduced. This suite is fully equipped and dedicated to testing PhpSerializer, making the software more reliable and robust.

Copy link

codecov bot commented Mar 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (642f32f) to head (0813e4d).

Additional details and impacted files
@@             Coverage Diff             @@
##              master       #80   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity        55        57    +2     
===========================================
  Files              2         3    +1     
  Lines            148       152    +4     
===========================================
+ Hits             148       152    +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Gerych1984 Gerych1984 force-pushed the custom-serializer branch 3 times, most recently from 36cb676 to afac545 Compare March 14, 2024 11:42
@vjik vjik added the status:code review The pull request needs review. label Mar 14, 2024
@vjik vjik requested a review from a team March 14, 2024 19:33
@terabytesoftw
Copy link
Member

terabytesoftw commented Mar 14, 2024

Wouldn't it be better to add the interface to yiisoft/cache ?

Otherwise everything seems very good, i would look for a better name for restore() method.

@Gerych1984
Copy link
Author

Gerych1984 commented Mar 14, 2024

Wouldn't it be better to add the interface to yiisoft/cache ?

It's no needed for ArrayCache. For ApcuCache and Memcached serializer can be changed in php.ini by *.serializer directive. So two packages where it can be useful - current and FileCache

@Gerych1984
Copy link
Author

Gerych1984 commented Mar 15, 2024

i would look for a better name for restore() method.

Renamed to unserialize

@vjik
Copy link
Member

vjik commented Mar 15, 2024

Agree with @terabytesoftw. Good idea is move serilalizer interface to base package yiisoft/cache

@Gerych1984
Copy link
Author

Done

@Gerych1984 Gerych1984 marked this pull request as draft March 16, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:code review The pull request needs review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants